package com.zycfc.zsf.boot.logback.core;

import java.io.*;
import com.zycfc.zsf.boot.util.text.*;
import com.zycfc.zsf.boot.logback.consts.*;
import java.util.*;
import com.zycfc.zsf.boot.util.time.*;
import java.time.*;
import java.time.format.*;

public class FileMonitorBuilder implements Serializable
{
    private static final long serialVersionUID = 1L;
    private String flowId;
    private String bizNo;
    private String bizType;
    private String fileNo;
    private String fileTitle;
    private String fileName;
    private Long fileSize;
    private Long fileDataRow;
    private String exeType;
    private String startTime;
    private String endTime;
    private Integer exeTm;
    private String exeSts;
    private String description;
    
    public FileMonitorBuilder() {
        this.exeSts = "S";
    }
    
    public FileMonitorBuilder setFlowId(String flowId) {
        if (StringUtils.isBlank((CharSequence)flowId)) {
            flowId = null;
        }
        this.flowId = flowId;
        return this;
    }
    
    public FileMonitorBuilder setBizNo(String bizNo) {
        if (StringUtils.isBlank((CharSequence)bizNo)) {
            bizNo = null;
        }
        this.bizNo = bizNo;
        return this;
    }
    
    public FileMonitorBuilder setBizType(final FileBizTypeEnum fileBizTypeEnum) {
        this.bizType = fileBizTypeEnum.getCode();
        return this;
    }
    
    public FileMonitorBuilder setFileNo(String fileNo) {
        if (StringUtils.isBlank((CharSequence)fileNo)) {
            fileNo = null;
        }
        this.fileNo = fileNo;
        return this;
    }
    
    public FileMonitorBuilder setFileTitle(String fileTitle) {
        if (StringUtils.isBlank((CharSequence)fileTitle)) {
            fileTitle = null;
        }
        this.fileTitle = fileTitle;
        return this;
    }
    
    public FileMonitorBuilder setFileName(String fileName) {
        if (StringUtils.isBlank((CharSequence)fileName)) {
            fileName = null;
        }
        this.fileName = fileName;
        return this;
    }
    
    public FileMonitorBuilder setFileSize(final Long fileSize) {
        this.fileSize = fileSize;
        return this;
    }
    
    public FileMonitorBuilder setFileDataRow(final Long fileDataRow) {
        this.fileDataRow = fileDataRow;
        return this;
    }
    
    public FileMonitorBuilder setExeType(final FileExeTypeEnum fileExeTypeEnum) {
        this.exeType = fileExeTypeEnum.getCode();
        return this;
    }
    
    public FileMonitorBuilder setStartTime(final Date startTime) {
        this.startTime = DateUtils.DEFAULT_ON_SECOND_FORMAT.format(startTime);
        return this;
    }
    
    public FileMonitorBuilder setStartTime(final LocalDateTime startTime) {
        this.startTime = startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        return this;
    }
    
    public FileMonitorBuilder setEndTime(final Date endTime) {
        this.endTime = DateUtils.DEFAULT_ON_SECOND_FORMAT.format(endTime);
        return this;
    }
    
    public FileMonitorBuilder setEndTime(final LocalDateTime endTime) {
        this.endTime = endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        return this;
    }
    
    public FileMonitorBuilder setExeTm(final Integer exeTm) {
        this.exeTm = exeTm;
        return this;
    }
    
    public FileMonitorBuilder setExeStsSucc() {
        this.exeSts = "S";
        return this;
    }
    
    public FileMonitorBuilder setExeStsFail() {
        this.exeSts = "F";
        return this;
    }
    
    public FileMonitorBuilder setDescription(String description) {
        if (StringUtils.isNotBlank((CharSequence)description)) {
            if (description.length() >= 2000) {
                description = description.substring(0, 2000);
            }
        }
        else {
            description = null;
        }
        this.description = description;
        return this;
    }
    
    public FileMonitor build() {
        if (this.fileSize == null) {
            this.fileSize = 0L;
        }
        if (this.fileDataRow == null) {
            this.fileDataRow = 0L;
        }
        return new FileMonitor(this);
    }
    
    public String getFlowId() {
        return this.flowId;
    }
    
    public String getBizNo() {
        return this.bizNo;
    }
    
    public String getBizType() {
        return this.bizType;
    }
    
    public String getFileNo() {
        return this.fileNo;
    }
    
    public String getFileTitle() {
        return this.fileTitle;
    }
    
    public String getFileName() {
        return this.fileName;
    }
    
    public Long getFileSize() {
        return this.fileSize;
    }
    
    public Long getFileDataRow() {
        return this.fileDataRow;
    }
    
    public String getExeType() {
        return this.exeType;
    }
    
    public String getStartTime() {
        return this.startTime;
    }
    
    public String getEndTime() {
        return this.endTime;
    }
    
    public Integer getExeTm() {
        return this.exeTm;
    }
    
    public String getExeSts() {
        return this.exeSts;
    }
    
    public String getDescription() {
        return this.description;
    }
}
